package com.fangyi.yunmusic.config;

import com.fangyi.yunmusic.utils.FileServerUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.io.File;

/**
 * 资源配置类
 */
@Configuration
@ConfigurationProperties(prefix = "com.fangyi.yunmusic")
@PropertySource("classpath:resource.properties")
public class ResourceConfig {

    private String fileServer;

    private String uploadServer;

    public String getFileServer() {
        return fileServer;
    }

    public void setFileServer(String fileServer) {
        this.fileServer = fileServer;
    }

    public String getUploadServer() {
        return uploadServer;
    }

    public void setUploadServer(String uploadServer) {
        this.uploadServer = uploadServer;
    }

    public String getUserAvatarUrl(String avatarImgId) {
        return FileServerUtils.getUserAvatarUrl(fileServer, avatarImgId);
    }

    public  String getPlaylistCoverUrl(String coverImgId) {
        return FileServerUtils.getPlaylistCoverUrl(fileServer, coverImgId);
    }

    public String getSongUrl(String songUrlId) {
        return FileServerUtils.getSongUrl(fileServer, songUrlId);
    }

    public String getAlbumCoverUrl(String coverImgId) {
        return FileServerUtils.getAlbumCoverUrl(fileServer, coverImgId);
    }

    public String getArtistPicUrl(String picId){
        return FileServerUtils.getArtistPicUrl(fileServer,picId);
    }
}
